<?
class Model_angkut extends CI_Model {

	function __construct()
	{
		parent::__construct();
		$this->CI = get_instance();
	}
	
	
	function get_angkut_grid(){	
		$this->db->select('*');
		$this->db->from('PENGANGKUTAN');
		$this->db->join('SATUAN', 'SATUAN.id_satuan= PENGANGKUTAN.id_satuan');
		$this->CI->flexigrid->build_query();
		
		$return['records'] = $this->db->get();
		
		$this->db->select('*');
		$this->db->from('PENGANGKUTAN');
		$this->db->join('SATUAN', 'SATUAN.id_satuan= PENGANGKUTAN.id_satuan');
		$this->CI->flexigrid->build_query(FALSE);
		
		$return['record_count'] = $this->db->count_all_results();

		return $return;
	}
	
	function selectone($id){
		$this->db->select("*");
		$this->db->from('PENGANGKUTAN');
		$this->db->where('ID_PENGANGKUTAN',$id);
		$query = $this->db->get();
		return $query;
	}
	
	function insert_angkut($data){
		$this->db->insert('PENGANGKUTAN',$data);
	}
	
	function update_angkut($data,$id){
		$this->db->where('ID_PENGANGKUTAN',$id);
		$this->db->update('PENGANGKUTAN',$data);
	}
	
	function delete_angkut($id){
		$this->db->where('ID_PENGANGKUTAN',$id);
		$this->db->delete('PENGANGKUTAN');
		
	}

	function get_satuan(){
		$this->db->select('*');
		$this->db->from('SATUAN');
		$query = $this->db->get();
		return $query;
	}
}
?>